home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / quick / form1.frm < prev    next >
Text File  |  1995-05-08  |  5KB  |  154 lines

  1. VERSION 2.00
  2. Begin Form Quick 
  3.    AutoRedraw      =   -1  'True
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Quick Exit"
  6.    ClientHeight    =   1095
  7.    ClientLeft      =   1800
  8.    ClientTop       =   1755
  9.    ClientWidth     =   3255
  10.    Height          =   1785
  11.    Icon            =   FORM1.FRX:0000
  12.    Left            =   1740
  13.    LinkTopic       =   "Quick"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   1095
  16.    ScaleWidth      =   3255
  17.    Top             =   1125
  18.    Width           =   3375
  19.    Begin CommandButton Command1 
  20.       Caption         =   "Re&boot"
  21.       Height          =   1095
  22.       Index           =   2
  23.       Left            =   2160
  24.       TabIndex        =   2
  25.       Top             =   0
  26.       Width           =   1095
  27.    End
  28.    Begin CommandButton Command1 
  29.       Caption         =   "E&xit"
  30.       DragIcon        =   FORM1.FRX:0302
  31.       Height          =   1095
  32.       Index           =   1
  33.       Left            =   1080
  34.       TabIndex        =   1
  35.       Top             =   0
  36.       Width           =   1095
  37.    End
  38.    Begin CommandButton Command1 
  39.       Caption         =   "&Restart"
  40.       DragIcon        =   FORM1.FRX:0604
  41.       Height          =   1095
  42.       Index           =   0
  43.       Left            =   0
  44.       TabIndex        =   0
  45.       Top             =   0
  46.       Width           =   1095
  47.    End
  48.    Begin Menu File 
  49.       Caption         =   "&File"
  50.       Begin Menu Exit 
  51.          Caption         =   "E&xit"
  52.       End
  53.    End
  54.    Begin Menu Options 
  55.       Caption         =   "&Options"
  56.       Begin Menu Stay 
  57.          Caption         =   "&Stay On Top"
  58.       End
  59.       Begin Menu Warn 
  60.          Caption         =   "&Warnings"
  61.       End
  62.    End
  63.    Begin Menu About 
  64.       Caption         =   "&About"
  65.    End
  66. End
  67. Declare Function ExitWindows Lib "User" (ByVal dwReturnCode As Long, ByVal wReserved As Integer) As Integer
  68. 'Return To Dos
  69. Const EW_ExitWindows = &H0
  70. 'Reboot Computer
  71. Const EW_Rebootsystem = &H43
  72. 'Restart Windows
  73. Const Ew_RestartWindows = &H42
  74. Declare Sub setWindowPos Lib "User" (ByVal H%, ByVal HB%, ByVal X%, ByVal Y%, ByVal Cx%, ByVal Cy%, ByVal F%)
  75.     Const SWP_NOSIZE = &H1 'Ignore size parameters
  76.     Const SWP_NOMOVE = &H2 'Ignore position parameters
  77.     Const SWP_SHOWWINDOW = &H40 'Display Windows
  78.     Const HWND_TOPMOST = -1 'Make window float
  79.  
  80. Const MB_YESNO = 4 'Define Buttons
  81. Const MB_ICONINFORMATION = 64 'Define Icon
  82. Const MB_DEFBUTTON2 = 256, IDYES = 6, IDNO = 7 'Define Other
  83.  
  84.  
  85.  
  86. Sub About_Click ()
  87. Load about1
  88. captiontext0 = "This program is Freeware. Enjoy it!" + Chr$(10)
  89. captiontext1 = "If you have any suggestions, I can be" + Chr$(10)
  90. captiontext2 = "reached by e-mail at abciiia@aol.com" + Chr$(10)
  91. captiontext3 = "or by snail mail at" + Chr$(10)
  92. captiontext4 = "A.B. Collver III" + Chr$(10) + "6701 San Bonita, Apt 3BE" + Chr$(10) + "St. Louis, MO 63105"
  93. about1.Label3.Caption = captiontext0 + captiontext1 + captiontext2 + captiontext3 + captiontext4
  94. about1.Show 1
  95. End Sub
  96.  
  97. Sub Command1_Click (Index As Integer)
  98. If warn.Checked <> True Then
  99.         GoTo Continue
  100.     Else Dim DgDef, Msg, Response, Title
  101. End If
  102. Continue:
  103. Select Case Index
  104.     Case 0 'If index = 0, Restart Windows In Current Mode
  105.         Msg = "Do you wish to Restart Windows?"
  106.         GoSub MessageBox
  107.         A% = ExitWindows(Ew_RestartWindows, 0)
  108.     Case 1 'If index = 1, Exit To Dos
  109.         Msg = "Do you wish to Exit Windows?"
  110.         GoSub MessageBox
  111.         A% = ExitWindows(EW_ExitWindows, 0)
  112.     Case 2 'If index =2, Reboot Computer
  113.         Msg = "Do you wish to Reboot your System?"
  114.         GoSub MessageBox
  115.         A% = ExitWindows(EW_Rebootsystem, 0)
  116. End Select
  117. MessageBox:
  118. If warn.Checked <> True Then
  119.         Return
  120.     Else
  121. Title = "Warning!"
  122. DgDef = MB_YESNO + MB_ICONINFORMATION + MB_DEFBUTTON2 'Describe Dialog Box
  123. Response = MsgBox(Msg, DgDef, Title)
  124.             If Response = IDYES Then
  125.                 Return
  126.             Else
  127.                 Exit Sub
  128.             End If
  129. End If
  130. End Sub
  131.  
  132. Sub Exit_Click ()
  133. Unload quick
  134. End
  135. End Sub
  136.  
  137. Sub Stay_Click ()
  138. Stay.Checked = Not Stay.Checked
  139. If Stay.Checked = True Then
  140.     'Sets Stay on Top
  141.     wFlags% = SWP_NOMOVE Or SWP_NOSIZE
  142.     Call setWindowPos(quick.hWnd, HWND_TOPMOST, 0, 0, 0, 0, wFlags%)
  143.        'Sets Stay on Top Off
  144.         Else wFlags% = SWP_SHOWWINDOW
  145.         Call setWindowPos(quick.hWnd, 1, quick.CurrentX, quick.CurrentY, quick.Width, quick.Height, wFlags%)
  146.         SendKeys "%{TAB}" 'Transfers focus
  147. End If
  148. End Sub
  149.  
  150. Sub Warn_Click ()
  151. warn.Checked = Not warn.Checked
  152. End Sub
  153.  
  154.